(function() {
    window.onload = function() {
        let btns = Array.from(document.querySelectorAll(".login-method span"));
        let pages = Array.from(document.querySelectorAll(".login-content"));
        // console.log(btns);
        // console.log(pages);

        btns.forEach(function(elm) {
            elm.onclick = function() {
                btns.forEach(function(el) {
                    el.classList.remove("method-active");
                });
                this.classList.add("method-active");
                var that = this;
                var _index = btns.findIndex(function(el) {
                    return el == that;
                });
                pages.forEach(function(el) {
                    el.classList.remove("active");
                });
                pages[_index].classList.add("active");
            };
        });
    };
})();